<template>
  <div class="app-container">
    <header class="app-header">
      <div class="header-content">
        <h1>用户和新闻管理系统</h1>
        <nav class="nav-menu">
          <router-link to="/" class="nav-link">首页</router-link>
          <router-link to="/news" class="nav-link">新闻页面</router-link>
        </nav>
      </div>
    </header>
    <main class="app-main">
      <router-view />
    </main>
    <footer class="app-footer">
      <p>© 2025 用户和新闻管理系统</p>
    </footer>
  </div>
</template>

<script setup>
// App组件
</script>

<style scoped>
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-base) var(--spacing-xl);
  box-shadow: var(--box-shadow-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition-base);
}

.app-header:hover {
  box-shadow: var(--box-shadow-dark);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.header-content h1 {
  color: white;
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0;
  transition: var(--transition-base);
}

.nav-menu {
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-base);
  border-radius: var(--border-radius-sm);
  transition: var(--transition-base);
  position: relative;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.nav-link.router-link-active {
  background-color: rgba(255, 255, 255, 0.25);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-link.router-link-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background-color: white;
  border-radius: 1.5px;
}

.app-main {
  flex: 1;
  padding: var(--spacing-xl);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  background-color: var(--bg-container);
  box-shadow: var(--box-shadow-base);
  border-radius: var(--border-radius-base);
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  min-height: calc(100vh - 280px);
}

.app-footer {
  background-color: var(--bg-container);
  padding: var(--spacing-lg);
  text-align: center;
  border-top: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-header {
    padding: var(--spacing-base);
  }
  
  .header-content {
    flex-direction: column;
    gap: var(--spacing-base);
  }
  
  .header-content h1 {
    font-size: var(--font-size-lg);
  }
  
  .nav-menu {
    gap: var(--spacing-base);
  }
  
  .nav-link {
    font-size: var(--font-size-sm);
    padding: var(--spacing-xs) var(--spacing-base);
  }
  
  .app-main {
    padding: var(--spacing-base);
    margin-top: var(--spacing-base);
    margin-bottom: var(--spacing-base);
    min-height: calc(100vh - 240px);
  }
}

/* 动画效果 */
.app-container {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.app-header,
.app-main,
.app-footer {
  animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
</style>